package com.zero.common;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;

public class RedisUtils {
    @Autowired
    private static RedisTemplate redisTemplate;

    public static void zsetOperation(){
        redisTemplate.opsForZSet().add("20211101", "杨幂", 3);
        redisTemplate.opsForZSet().add("20211101", "迪丽热巴", 7);
        redisTemplate.opsForZSet().add("20211101", "杨洋", 8);
        redisTemplate.opsForZSet().add("20211102", "杨洋", 8);
        System.out.println(redisTemplate.opsForZSet().range("20211101", 0, 2));
        redisTemplate.opsForZSet().unionAndStore("20211101-20211102", "20211101", "20211102");
    }
}
